<template>
  <div class="container-content programme">
    <el-card shadow="never">
      <el-form
        ref="formRef"
        :model="formObject"
        label-width="100px"
        label-position="left"
        class="programme-form"
      >
        <el-form-item label="组织名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="部门名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="项目名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="项目编码">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="客户Id">
          <el-input v-model="formObject.customerId"></el-input>
        </el-form-item>
        <el-form-item label="勘测报告Id">
          <el-input v-model="formObject.surveyReportId"></el-input>
        </el-form-item>
        <el-form-item label="方案名称">
          <el-input v-model="formObject.programmeName"></el-input>
        </el-form-item>
        <el-form-item label="方案出具人">
          <el-input v-model="formObject.programmeUserId"></el-input>
        </el-form-item>
        <el-form-item label="方案内容">
          <el-input v-model="formObject.programmeContent"></el-input>
        </el-form-item>
        <el-form-item label="报价金额">
          <el-input v-model="formObject.amount"></el-input>
        </el-form-item>
        <el-form-item label="方案出具日期">
          <el-date-picker
            v-model="formObject.programmeTime"
            type="date"
            placeholder="选择日期"
            style="width: 100%"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="客户反馈">
          <el-input v-model="formObject.customerFeedback"></el-input>
        </el-form-item>
        <el-form-item label="概算来源">
          <el-radio v-model="formObject.estimateSource" :label="1" border
            >己方概算</el-radio
          >
          <el-radio v-model="formObject.estimateSource" :label="2" border
            >客户提供</el-radio
          >
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="formObject.remarks" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="附件上传">
          <el-upload class="upload-demo" multiple :limit="3">
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>
<script>
import {
  addProList,
  editProList,
  getDetailProList,
} from "@/api/system/survey/";
export default {
  props: ["id"],
  data() {
    return {
      formObject: {
        changeTime: "",
        createBy: "",
        createTime: "",
        customerFeedback: "",
        customerId: "",
        estimateSource: 0,
        id: "",

        money: "",
        amount: "",
        params: {},
        programmeContent: "",
        programmeName: "",
        programmeTime: "",
        programmeUserId: "",
        remark: "",
        remarks: "",
        searchValue: "",
        surveyReportId: "",
        updateBy: "",
        updateTime: "",
        userId: "",
      },
    };
  },
  methods: {
    onSubmit() {
      if (this.id) {
        editProList(this.formObject).then((res) => {
          if (res.code === 200) {
            this.$message({
              message: "修改成功！",
              type: "success",
            });
          }
        });
      } else {
        addProList(this.formObject).then((res) => {
          if (res.code === 200) {
            this.$message({
              message: "新增成功！",
              type: "success",
            });
          }
        });
      }
    },
    getData(id) {
      getDetailProList(id).then((res) => {
        if (res.code === 200) {
          this.formObject = res.data;
        }
      });
    },
  },
  created() {
    if (this.id) {
      this.getData(this.id);
    }
  },
};
</script>
<style lang="scss" scoped></style>
